<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <%-- 页头 --%>
    <%@include file="common/head.jsp" %>

    <style>
        .card-article:hover {
            background-color: #DFF0D8;
            border-radius: 10px;
        }
    </style>
</head>
<body>
<div class="wrapper">

    <%-- 导航 --%>
    <%@include file="common/header.jsp" %>

    <%-- 侧边栏 --%>
    <%@include file="common/sidebar.jsp" %>

    <div class="main-panel">
        <div class="content">
            <div class="container-fluid">
                <c:forEach items="${articleVoList}" var="vo" varStatus="status">
                    <div class="row articles" id="a-${vo.articleCategory.acId}">
                        <div class="col-md-12">
                            <div class="card">
                                <div class="card-header">
                                    <h4 class="card-title">${vo.articleCategory.acTitle}</h4>
                                    <p class="card-category">${vo.articleCategory.acIntroduce}</p>
                                </div>
                                <div class="card-body">
                                    <div class="row">
                                        <c:forEach items="${articleVoList.get(status.index).articleList}" var="article">
                                            <div class="col-md-3">
                                                <div class="card card-stats" style="background-color: #d9edf7; border-radius: 10px">
                                                    <div class="card-body card-article"
                                                         onclick="window.location.href='/article/detail/${article.articleId}'">
                                                        <div class="row">
                                                            <div class="col-4">
                                                                <div class="icon-big text-center">
                                                                    <i class="la ${article.articleIcon}"></i>
                                                                </div>
                                                            </div>
                                                            <div class="col-8 d-flex align-items-center">
                                                                <div class="numbers">
                                                                    <h4 class="card-title">${article.articleTitle}</h4>
                                                                    <p class="card-category">${article.articleIntroduce}</p>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </c:forEach>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </c:forEach>
            </div>
        </div>
    </div>
</div>

<%-- 页脚 --%>
<%@include file="common/footer.jsp" %>

</div>

</body>

<%-- js --%>
<%@include file="common/script.jsp" %>

<script>
    $(function () {
        $(".nav>li:first").addClass('active');

        $(".nav>li").on("click", function () {
            $(this).siblings('li').removeClass('active');
            $(this).addClass('active');
            var acId = $(this).attr("id");
            console.log(acId);
            $(".articles").each(function () {
                if ('a-' + acId == $($(this))[0].id) {
                    $(this).show();
                } else {
                    $(this).hide();
                }
            });
        });
    });
</script>
</html>